V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  bakabie  ›  全部回复第 6 页 / 共 6 页
回复总数  107
1  2  3  4  5  6  
2016-12-31 17:53:25 +08:00
回复了 bakabie 创建的主题 Python 请教一个文件读取的问题
@weyou 我也知道 read 文件指针会移动到尾部。。然而第一次读取貌似也是什么都没有。。 route 。。应该是 ruote 。。手打打太快了_(:з)∠)_。。。。
2016-12-31 10:32:17 +08:00
回复了 bakabie 创建的主题 Python 请教一个文件读取的问题
@icedx
flask 工程代码:

import flask,os,time
import shutil
app = flask.Flask(__name__)
PageListbuff =[]
def ArichverData(id):
pass
def LoadArichversList():
tempList = []
files = os.listdir("Arichvers")
print files
#print files
for item in files:
titlefile = open("Arichvers/"+str(item)+"/title",'r')
tempList.append({"href":WebSiteUrl+titlefile.read(),"title":titlefile.read(),"Data":ArichverData(str(item))[0]})
print os.path.isfile("Arichvers/"+str(item)+"/title")
print os.listdir("Arichvers/"+str(item))
print titlefile.read()
titlefile.close()

PageListbuff=tempList
@app.ruote("/")
def index():
pass
if __name__ == '__main__':
LoadArichversList()

app.run(host='0.0.0.0',port=80,threaded=True)

cmdshell 下直接进入 python 执行的代码就在图中,非常短
2016-12-31 10:15:10 +08:00
回复了 bakabie 创建的主题 Python 请教一个文件读取的问题
@manhere 尴尬了。。。不过幸好是别人的代码,不然真的丢脸了
2016-12-31 10:12:31 +08:00
回复了 bakabie 创建的主题 Python 请教一个文件读取的问题
@misaka19000 路径是正确的,不然读不到["content","data","title"]这个 listdir 的_(:з)∠)_
2016-12-31 10:11:39 +08:00
回复了 bakabie 创建的主题 Python 请教一个文件读取的问题
@imn1 同样都是管理员权限,同样用 cmdshell 执行 flas 工程脚本也是无法读取到,不过写文件什么的却依旧可以
2016-01-18 19:10:31 +08:00
回复了 Yourdaye 创建的主题 Python 被 python 的编码问题折腾死了
检查下 ide 的编码设置是否正确。。。
我之前也是这样,在 pycharm 上无法输出中文。。。结果发现是 pycharm 内置编码没设置正确
2015-07-26 15:55:38 +08:00
回复了 dhnUphp 创建的主题 程序员 天天吹键盘,问一下你们鼠标用的啥。。。。
IBM 的小红点233333
1  2  3  4  5  6  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1903 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 00:18 · PVG 08:18 · LAX 17:18 · JFK 20:18
Developed with CodeLauncher
♥ Do have faith in what you're doing.