Python URLlib 表单帮助

发布于 2024-11-15 23:29:50 字数 734 浏览 0 评论 0原文

我正在尝试制作一个程序,该程序将访问 http://mailfreeonline.com/free_anonymous_mail 并向我发送电子邮件。这是我到目前为止所得到的,它说第二个冒号有语法错误?

import urllib

params = urllib.urlencode(
    {'tomailget': '[email protected]',
     'fromnameget': 'Matt'
     'frommailget': '[email protected]'
     'subjectget': 'Subject'
     'messageget': 'Message'     })
f = urllib.urlopen("http://www.mailfreeonline.com/free_anonymous_mail", params)

I am trying to make a program that will access http://mailfreeonline.com/free_anonymous_mail and send me an email. This is what I have so far, it says there is a syntax error with the second colon?

import urllib

params = urllib.urlencode(
    {'tomailget': '[email protected]',
     'fromnameget': 'Matt'
     'frommailget': '[email protected]'
     'subjectget': 'Subject'
     'messageget': 'Message'     })
f = urllib.urlopen("http://www.mailfreeonline.com/free_anonymous_mail", params)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪操控生活 2024-11-22 23:29:50

你必须在每个参数后面添加逗号,你忘了这样做

      params = urllib.urlencode( {'tomailget': '[email protected]', 
                                  'fromnameget': 'Matt',    
                                  'frommailget': '[email protected]', 
                                  'subjectget': 'Subject', 
                                  'messageget': 'Message' }) 

You have to add comma after each parameter, you forgot to do that

      params = urllib.urlencode( {'tomailget': '[email protected]', 
                                  'fromnameget': 'Matt',    
                                  'frommailget': '[email protected]', 
                                  'subjectget': 'Subject', 
                                  'messageget': 'Message' }) 
日记撕了你也走了 2024-11-22 23:29:50

我在字典中没有看到元素之间有逗号

 {'tomailget': '[email protected]',
 'fromnameget': 'Matt'**,**
 'frommailget': '[email protected]'**,**
 'subjectget': 'Subject'**,**
 'messageget': 'Message'     })

I don't see commas between the elements in the dictionary

 {'tomailget': '[email protected]',
 'fromnameget': 'Matt'**,**
 'frommailget': '[email protected]'**,**
 'subjectget': 'Subject'**,**
 'messageget': 'Message'     })
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文