文件i / o问题(file i/o problem)
我遇到一个非常简单的问题。 我正在尝试删除文件中的换行符并将输出发送到新文件。 这是我的代码:
infile = open('seq.txt', mode='r', encoding='utf-8') lines = infile.readlines() for line in lines: par = line.strip('\n') outfile = open('seqpar.txt', mode='w', encoding='utf-8') for line in lines: outfile.write(par)
当我运行上面的代码时,outfile(seqpar.txt)的内容是完全空白的。 我试图在线搜索I / O教程,但我似乎无法找到类似问题的任何解决方案。 由于某种原因,我在理解文件I / O时遇到了麻烦。请提前感谢您的帮助。
I am having trouble with a really simple problem. I'm trying to remove line breaks in a file and send the output to a new file. This is my code:
infile = open('seq.txt', mode='r', encoding='utf-8') lines = infile.readlines() for line in lines: par = line.strip('\n') outfile = open('seqpar.txt', mode='w', encoding='utf-8') for line in lines: outfile.write(par)
When I run the above code, the contents of the outfile (seqpar.txt) is completely blank. I've tried to search for I/O tutorials online, but I can't seem to locate any solutions to a similar problem. I'm really having trouble with understanding file I/O for some reason.Thanks in advance for the help.
原文:https://stackoverflow.com/questions/6043537
满意答案
看起来像格式化的问题。
您需要使用
$filter=(Bokning_x0020_fr_x00e5_n ge datetime'2017-10-03T00:28:05Z') and (Bokning_x0020_till le datetime'2010-04-02T00:28:08Z')
所以,你的网址是:
var url = `${_spPageContextInfo.webAbsoluteUrl}/_api/web/lists/getbytitle('Program')/items? $filter=(Bokning_x0020_fr_x00e5_n ge datetime'2017-10-03T00:28:05Z') and (Bokning_x0020_till le datetime'2010-04-02T00:28:08Z') $select=Title,Bokning_x0020_fr_x00e5_n,Bokning_x0020_till,Kontaktperson,Max_x0020_antal_x0020_platser;
Looks like some issue with formatting.
You need to use
$filter=(Bokning_x0020_fr_x00e5_n ge datetime'2017-10-03T00:28:05Z') and (Bokning_x0020_till le datetime'2010-04-02T00:28:08Z')
So, your url would be:
var url = `${_spPageContextInfo.webAbsoluteUrl}/_api/web/lists/getbytitle('Program')/items? $filter=(Bokning_x0020_fr_x00e5_n ge datetime'2017-10-03T00:28:05Z') and (Bokning_x0020_till le datetime'2010-04-02T00:28:08Z') $select=Title,Bokning_x0020_fr_x00e5_n,Bokning_x0020_till,Kontaktperson,Max_x0020_antal_x0020_platser;
相关问答
更多对Sharepoint REST API进行CAML查询会导致“无效的受众URI”?(CAML-query to Sharepoint REST API results in “invalid audience URI”?)
Rest API中的Sharepoint GetListsOfType(Sharepoint GetListsOfType in Rest API)
使用REST API获取SharePoint列表的不同数据(Get distinct data of SharePoint list using REST API)
SharePoint REST _api DateTimeRange查询(SharePoint REST _api DateTimeRange query)
Sharepoint REST API和MVC AAD连接(Sharepoint REST api and MVC AAD connect)
SharePoint 2013搜索REST API(SharePoint 2013 search REST API)
使用rest api进行sharepoint搜索(sharepoint search using rest api)
Sharepoint 2010博客 - 按类别订购休息查询(Sharepoint 2010 Blog - Order rest query by Category)
Sharepoint 2013 - 通过REST api仅获取上次批准的版本(Sharepoint 2013 - Fetch only last approved version through REST api)
getChanges Sharepoint rest API(getChanges Sharepoint rest API)
相关文章
更多Hadoop的I/O
Hadoop I/O系统介绍
Hadoop1.0.4 HDFS I/O性能测试
Java中如何用I/O流读取一个Word文档的内容?
O2O
Bentley.STAAD.RCDC.V8i.04.01.01.03 1CD
《O'Reilly:深入HTML5应用开发》扫描版[PDF]
I18n的一个问题
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!