print语句默认是输出一行后添加一个换行符 >>> for item in ['apple','ibm','google','oracle']: ... print item ... apple ibm google oracle 在print语句的最后添加一个逗号(,),改变其默认行为: >>> for item in ['apple','ibm','google','oracle']: ... print item, ... apple ibm google or
1. Print them to screen man = [] other = [] try: data = open('sketch.txt') for each_line in data: try: (role, line_spoken) = each_line.split(':',1) line_spoken=line_spoken.strip() if role== 'Man': man.append(line_spoken) elif role == 'Other Man': oth
写个博客记录下,方便以后使用: public class WriteHelper { public static void WriteFile(object data) { try { string path = $@"D:\TokenLog\day{DateTime.Now:yyyy-MM-dd}"; var filename = $"TokenLog{DateTime.Now:yyyy-MM-dd HH}.txt"; if (!Directory.Exists(