欢迎您来到谷歌搜索在中国的新家 Google.com.hk

北京时间2010年3月22日凌晨2:30左右,访问Google.cn,直接跳转到Google.com.hk,网页上Google高兴的宣布:

欢迎您来到谷歌搜索在中国的新家

Google.cn已经离我们而去,再见!

Update:在国外访问Google.cn,也会被强制跳转到Google.com.hk。

转载于:https://www.cnblogs.com/Robin2005/archive/2010/03/23/1692146.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好,那么你可以使用 Python 的文件操作来读取 txt 文件中的内容,并将其添加到 FASTA 文件的 ID 后面。下面是一个示例代码,它可以读取一个名为 "new_ids.txt" 的文件,并将其中的内容添加到 FASTA 文件的 ID 后面。 ``` import os # 输入文件名、新 ID 文件名和输出文件名 input_file = "example.fasta" new_id_file = "new_ids.txt" output_file = "example_new.fasta" # 检查输入文件、新 ID 文件和输出文件是否存在 if not os.path.exists(input_file): print("Error: Input file does not exist!") exit() if not os.path.exists(new_id_file): print("Error: New ID file does not exist!") exit() # 读取新 ID 文件中的内容 new_ids = {} with open(new_id_file, "r") as f: for line in f: old_id, new_content = line.strip().split() new_ids[old_id] = new_content # 打开输入文件和输出文件 with open(input_file, "r") as f_in, open(output_file, "w") as f_out: # 初始化变量 current_id = "" current_seq = "" # 读取输入文件的每一行 for line in f_in: # 如果这一行是 ID 行,则保存上一个序列并更新当前 ID if line.startswith(">"): if current_id: new_content = new_ids.get(current_id, "") f_out.write(current_id + new_content + "\n") f_out.write(current_seq + "\n") current_id = line.strip() current_seq = "" # 如果这一行是序列行,则将序列加入当前序列中 else: current_seq += line.strip() # 保存最后一个序列 if current_id: new_content = new_ids.get(current_id, "") f_out.write(current_id + new_content + "\n") f_out.write(current_seq + "\n") print("Done!") ``` 在这个代码中,我们首先检查输入文件和新 ID 文件是否存在,然后读取新 ID 文件中的内容,并将其存储在一个字典中。接下来,我们打开输入文件和输出文件,并逐行读取输入文件。如果这一行是 ID 行,我们将上一个序列写入输出文件,并更新当前 ID。在写入输出文件时,我们根据当前 ID 从字典中获取对应的新内容,并将其添加到 ID 后面。如果没有找到对应的新内容,则将空字符串添加到 ID 后面。如果这一行是序列行,则将序列加入当前序列中。在处理完所有行之后,我们将最后一个序列写入输出文件中,并关闭输入文件和输出文件。 在这个示例代码中,我们假设新 ID 文件中的每一行都包含两个元素,用空格分隔。第一个元素是原始的 ID,第二个元素是要添加到 ID 后面的新内容。你可以根据实际情况修改代码,以适应不同的新 ID 文件格式。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值