- 博客(18)
- 收藏
- 关注
原创 编写第一个JAVA程序
public class HelloWorld{ public static void main(String args[]){ System.out.println("HelloWorld!"); }}
2022-06-04 22:46:00
298
原创 删除文件中含某关键词的行
#!/usr/bin/env python3#matchPattern = re.compile(r'keywords')import relist = []#matchPattern = re.compile(r'apple')#matchPattern = re.compile(r'apple:')#matchPattern = re.compile(r'apple=')#matchPattern = re.compile(r'apple_name')matchPattern = r.
2022-05-26 23:40:01
376
原创 保存用户输入的数据到文件中
1、访客:编写一个程序,提示用户输入其名字;用户作出响应后,将其名字写入到文件guest.txt中>>> name = input("What is your name? ")What is your name? Cora>>> filename = 'guest.txt'>>> with open(filename,'w') as file_object:... file_object.write(name)...4>
2022-01-24 02:18:57
484
原创 创建名称为当前时间(年月日)的目录,在这个目录下创建名称为当前时间(年月日时分秒)的txt文件,并且输入一段内容
import timeimport osimport localelocale.setlocale(locale.LC_CTYPE,'chinese')t1 = time.strftime("%Y-%m-%d",time.localtime())t2 = time.strftime("%Y-%m-%d %H%M%S",time.localtime())print(t1)print(t2)os.chdir("C:\\")os.mkdir(t1)os.chdir(t1)filename.
2022-01-23 16:16:39
868
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅