小编Ole*_*ous的帖子

Python基础知识 - 为什么不是我的文件打印的内容?

我是从eclipse运行的,我正在使用的文件名是ex16_text.txt(是的我输入正确.它正确地写入文件(输入出现),但是"print txt.read()"似乎没有做任何事情(打印一个空行),看到代码后的输出:

filename = raw_input("What's the file name we'll be working with?")

print "we're going to erase %s" % filename

print "opening the file"
target = open(filename, 'w')

print "erasing the file"
target.truncate()

print "give me 3 lines to replace file contents:"

line1 = raw_input("line 1: ")
line2 = raw_input("line 2: ")
line3 = raw_input("line 3: ")

print "writing lines to file"

target.write(line1+"\n")
target.write(line2+"\n")
target.write(line3)

#file read
txt = open(filename)

print "here are the contents of the %s file:" % …
Run Code Online (Sandbox Code Playgroud)

python

3
推荐指数
1
解决办法
2260
查看次数

XAMPP“模块'mysqli'已加载”错误?

XAMPP已配置并正常运行,能够访问phpmyadmin并在本地服务器上执行php代码。在启动XAMPP和启动Apache之后的今天早上,我收到一条消息:“模块'mysqli'已加载”。

我无法登录phpmyadmin,我看到登录页面,但是当我单击“ go”时,我只会得到一个空白页面。我正在练习将表单提交到数据库中,一切正常,现在提交表单后,出现了以下消息:“连接失败:(2002年),连接尝试失败,因为在一段时间后,被连接方未正确响应,或建立的连接失败,因为连接的主机无法响应。”

XAMPP状态页显示一切都被激活。我不记得进行任何配置更改或进行其他可能导致此问题的操作。

感谢任何输入。

xampp

2
推荐指数
1
解决办法
2490
查看次数

标签 统计

python ×1

xampp ×1