`
mlzboy
  • 浏览: 701724 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

why python doesn't have a writeline() method like c# ?

阅读更多
<script src="http://pagead2.googlesyndication.com/pagead/expansion_embed.js"></script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script>

just curious, it would make writing to a file  a bit easier?

 

ww <mrwwli <at> gmail.com> writes:

>
> just curious, it would make writing to a file  a bit easier?

Because readline() returns the line with the newline attached, writeline() would
have to require a newline at the. Therefore, it would be equivalent to write()!

Just use f.write("some line\n").

 from

http://www.opensubscriber.com/message/python-list@python.org/11602035.html 


blog client has some thing wrong,i write two times,but it disappear  curious,so finally i put the link over here as a memo

分享到:
评论

相关推荐

    C# .net 文件操作工具类

    C# .net 文件操作工具类

    c# 反射实例

    //c# 反射实例 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace ConsoleApplication1 { class Program { static void Main( string...

    C#面向对象考试题目

    非常齐全的C#考试题目 在C#程序中,下列用来处理异常的结构,错误的是( )。 a) catch{}finally{} b) try{}finally{} 在C#中,下列变量定义与赋值正确的是( )。 a) int age=12.5; b) string name = sodi; ...

    c#关键字使用示例代码

    c#关键字使用示例代码,描述了c#常见关键字在代码中如何运用的: namespace TestIs { class Class1 { } class Class2 { } class IsTest { static void Test(Object o) { Class1 a; Class2 b; if (o is ...

    if Swich例子,C#源代码//测试if和else

    if Swich例子,C#C#源代码//测试if和else void testIfElse() { if (age &gt;= 22) { Console.WriteLine( "if-else测试:\t{0}有{1}岁,可以结婚。", name, age); } else if ((age ) && (age &gt;= 18)) { Console...

    在一小时内学会 C#(txt版本)

    在一小时内学会 C#。使用例程,简单却完整的探索 C# 语言的构造和特点。本文特别适合有 C++ 基础却没有太多精力学习 C# 的读者。 关于作者 Aisha Ikram 我现在在英国一家软件公司任技术带头人。我是计算机科学的...

    C#中Write()和WriteLine()的区别分析

    Write()和WriteLine()都是System.Console提供的方法,两着主要用来将输出流由指定的输出装置(默认为屏幕)显示出来. 两着间的差异在 Console.WriteLine()方法是将要输出的字符串与换行控制字符一起输出,当次语句执行...

    IronPython 是.NET框架公共语言运行时(CLR)上Python实现-python

    IronPython是Python编程... Windows/Linux/macOS 构建下载 无发布 帮助 IronPython 与 C# 的“Hello World”比较 C#:使用系统; class Hello { static void Main() { Console.WriteLine("Hello World"); IronPython

    C#getopt(命令行处理函数)

    C#中的getopt封装,方便处理cmd命令。添加引用后,使用范例如下: ... Console.WriteLine("aflag = {0}, bflag = {1}, cvalue = {2}", aflag, bflag, cvalue); for ( int n = GetOpt.Index ; n ; n++ )

    传智播客C#自测题

    3、C#中使用哪个语句捕获异常 A)if B)while C)try...catch D)do 4、在.Net类库中,使用哪个类进行数据类型转换? A)System.Convert B)System.Type C)System.Object D)System.String 5、以下程序的执行...

    C# 进制转换的实现(二进制、十六进制、十进制互转)

    由于二进制数在C#中无法直接表示,所以所有二进制数都用一个字符串来表示 例如: 二进制: 1010 表示为 字符串:”1010″  int d = 10; //十进制转二进制字符串 Console.WriteLine(Convert.ToString(d,2)); //...

    C#像java一样优雅的解析JSON数据

    C#的一个解析JSON的工具类,像java一样优雅的解析JSON数据,包含有JSONObject和JSONArray对象。 JSONObject json = new JSONObject(); json.Put("sex", "男"); json.Put("age", 123); json.Put("name", "张三"); ...

    浙政钉服务端免登.NET(C#)SDK

    DDHelp dd = new DDHelp(); dd.DomainName = "domian"; dd.AccessKey = "APPKEY";... string _u = dd.GetUser(_t.content.data.accessToken, "a37e2b47f87648e3a342e75c8589c704a6dc4e01"); Console.WriteLine(_u);

    c#递归求和算法

    c#入门简单代码,适合新手,简单的递归求和实现。 主函数 static void Main(string[] args) { Class1 aa = new Class1(); Console.WriteLine("请输入待求阶乘的数:"); int n = Convert.ToInt32(Console....

    c#复习题 珍藏版

    Console.WriteLine(c.m_A.m_valuel.GetType()); Console.WriteLine(c.m_A.m_value2.GetType()); Console.WriteLine(c.m_B.m_A.m_valuel.GetType()); Console.WriteLine(c.m_B.m_A.m_value2.GetType());

    C#获取并修改文件扩展名的方法

    本文实例讲述了C#获取并修改文件扩展名的方法。分享给大家供大家参考。具体分析如下: 这里使用C#编程的方法改变文件扩展名的文件,必须使用Path类。 Path类用来解析文件系统路径的各个部分。静态方法Path....

    C#实验指导书(新)

    System.Console.WriteLine(“Hello,这是我的第一个C#程序”); } } 保存文件为D:\myCs\HelloWord.cs 选择开始——程序——Microsoft Visual Studio.Net——.Net工具——命令提示,打开命令提示窗口。

    C#写的IP地址转换作业

    Console.WriteLine("\n\t\tAssignment 3 IP Parser( IP 解析程序)\n\n"); Console.WriteLine("********************************************************************\n"); Console.WriteLine("\n\n用法:IP地址...

    // Console.WriteLine(cs[9]);c#教材

    相当帮的教程你们一定要下载 上我点分 我记着下载

    C#基础之数据类型转换

    Console.WriteLine(x);  输出结果:  我们知道long类型的取值范围是-9223372036854775805~+9223372036854775807;int类型的是:-2147483648~+2147483647 上面的代码中,由于long变量的值超过了int能容纳的最大值...

Global site tag (gtag.js) - Google Analytics