- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
电子邮件验证
#Email validator
import re
def is_email():
email=input("Enter your email")
pattern = '[\.\w]{1,}[@]\w+[.]\w+'
file = open('ValidEmails.txt','r')
if re.match(pattern, email):
file.write(email)
我想知道为什么我的数据不会写入磁盘。 Python说不支持我的操作。
is_email
file.write(email)
io.UnsupportedOperation: not writable
最佳答案
您以只读方式打开变量"file",然后尝试写入:
file = open('ValidEmails.txt','r')
改为使用 'w' 标志。
file = open('ValidEmails.txt','w')
...
file.write(email)
关于python - 不支持的操作 :not writeable python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27278755/
我真的很难过。在我的服务器日志中,我看到: org.apache.coyote.CloseNowException: Connection [215], Stream [95], This strea
电子邮件验证 #Email validator import re def is_email(): email=input("Enter your email") pattern =
我正在尝试遵循 google cloud site 中的这个简单的数据流示例。 我已成功安装数据流管道插件和 gcloud SDK(以及 Python 2.7)。我还在谷歌云上建立了一个项目,并启用了
我正在研究一种实用方法,该方法允许将 XML 数据转换为格式化的 String ,在您认为这对于 javax.xml.transform.Transformer< 来说是一项微不足道的任务之前 让我解
我有一个 BPF 代码(“classifier”部分)。我使用它加载到使用 tc(流量 Controller )实用程序的界面。我的代码更改了 __skbuff 中的标记。后来当我尝试使用 iptab
我有一台新 Macbook - 一个用户安装了它,然后我安装了一个新用户(我的),授予管理员权限并删除了旧用户。我在 OS Catalina 上。 自从安装以来,我一直有几个权限问题。 VSCode
我已将本地主机文件上传到我的网站,但它显示此错误:- : [2] file_put_contents( ***WebsiteURL*** /cache/lang/ ***FileName*** .ph
当我在 Node 中实现可写流时,我必须实现的唯一方法是_write。但我怎么知道不会再有数据了? 我的流的使用者通过 mystream.end(data) 结束传输,当我完成写入时,他还会收到一个
我正在开发一个使用大量 PHP 脚本实现的网站。整个网站是一个在专用 Apache 服务器上运行的 git 存储库。该服务器将为全世界提供一个网站,但不包含任何经销商子帐户/经销商帐户。 检查错误日志
这个问题在这里已经有了答案: PHP move_uploaded_file is Not uploading Images when full web path is given in Unix s
每当我尝试安装新的 python 包时,我都会首先收到此消息: Defaulting to user installation because normal site-packages is not
SQLiteOpenHelper.getWriteableDatabase() 我收到的错误信息是: Failed to setLocale() when constructing, closing
node.js 中是否有针对 net.socket 连接的“可写”或连接测试?或者我必须做这样的事情: var client = new net.Socket(); var isConnected =
我正在尝试运行: sudo pecl channel-update pecl.php.net 因为每次我尝试安装一个包时,它都会提示我运行它。但是,当我运行这些命令时,我得到:“当前用户无法写入注册表
我正在使用亚马逊 EC2 服务器进行托管.. 我遇到了一个问题:-我必须将一个文件从我的服务器复制到亚马逊存储桶 我正在使用 $str = file_get_contents(' http://www
我已经安装了新版本的 Android Studio 3.4.2。 我在较旧的 android studio 版本中开发了几个 android 项目。但现在我无法在 3.4.2 版本中生成签名的 apk
我正在尝试在 OS X 上安装 oAuth,但在终端中出现此错误: Cannot install, php_dir for channel "pecl.php.net" is not writeabl
得到了错误Error : package ‘stringr’ was installed before R 4.0.0: please re-install it和 B iocManager Inst
我是一名优秀的程序员,十分优秀!