Python Forum
Manipulation a file for translation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manipulation a file for translation
#1
Hello Everyone!
I want to translate game files, but first i need to separate stuff than needs translation from the rest of the code.
Here is a part of code:

Output:
m0700301005 0 0 0 0 0 阿莉,你又来了...上次在都司军营排队的事你忘了吗? 0 0 0 m0700301006 0 0 0 0 0 人都排到外面来了啊...Xi Pao在不在这呢... 0 0 0 m0700302000 0 0 0 0 0 这里排队如此之长,我还是改天再来吧。 0 0 0 m0700401000 0 0 0 0 0 小二,上菜! 0 0 0 m0700401001 0 0 0 0 0 牛肉白干,都给我端上桌来! 0 0 0 m0700401002 0 0 0 0 0 今日可要探清这里酿的酒! 0 0 0 m0700401003 0 0 0 0 0 不错,我们可不能给Beauty Restaurant比下去了! 0 0 0 m0700401004 0 0 0 0 0 Everyone is full of wine and food. Let's go for a big ticket in the evening. 0 0 0 m0700401005 0 0 0 0 0 小弟敬老大一杯! 0 0 0 m0700401006 0 0 0 0 0 好吃好吃!蜀中第一客店名不虚传! 0 0 0 m0700401007 0 0 0 0 0 什么Home Easy Meal、One Hand of Heaven and Earth,一道菜也有这么多名堂? 0 0 0 m0700402000 0 m0700402001 0 0 0 人真是多啊...不愧是蜀中第一客店,其他地方的客店不过三三两两的客人,这地方简直是人山人海。 0 0 0 m0700402001 0 m0700402002 0 0 0 南闲说这Treasure Club已与那Bu Shelou对抗了好一段时间,这么说来,Xi Pao或许对这些家伙的底细会知道得更清楚些... 0 0 0 m0700402002 0 0 0 0 0 不过这Xi Pao究竟会在什么地方呢? 0 0 0 m0700402003 0 m0700402004 0 n07008a 0 客倌啊,没见着外头排着一长龙呢! 0 0 { "MultiAction" : [ { "NpcNavRotateAction" : "player", { 0.00000, 153.99720, 0.00000} , Null} ]} m0700402004 0 m0700402005 0 0 0 哇啊!?你...你是小二吗?什么时候出现的? 0 m_talk009_ec 0 0 m0700402005 0 m0700402006 0 n07008a 0 哎!客倌好眼力,小的正是这Beauty Restaurant的小二,人称三瞬三息Bu Juechen,正是小的! 0 m_talk001 0 0 m0700402006 0 m0700402007 0 n07008a 0 小店现在客满了,没法接待您,还请您别插队,在外头候着啊! 0 0 0 m0700402007 0 m0700402008 0 0 0 ...三瞬三息? 0 m_talk015 0 0
I dont even know how to start, so anything would be helpfull.

PS:Original file have different spaces between 0's and other parts of code.It got comressed as i copied it here.
Reply
#2
with open("input", encoding="utf-8") as f:
    with open("output", "w", encoding="utf-8") as output:
        output.writelines(line.split()[6] + "\n" for line in f)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Translation AliceCu 2 656 May-16-2023, 09:05 PM
Last Post: deanhystad
  Translation API snippyro 0 1,252 Nov-02-2021, 01:09 AM
Last Post: snippyro
  [GoogleTrans] How can i print my translation word ?... JamieVanCadsand 7 11,698 Aug-29-2021, 12:01 PM
Last Post: Melcu54
  Text File Manipulation Queries? JustJeff 2 2,112 Apr-10-2021, 08:12 PM
Last Post: JustJeff
  Translation of R Code to Python for Statistical Learning Course SterlingAesir 2 2,133 Aug-27-2020, 08:46 AM
Last Post: ndc85430
  recording a translation table into a file arbiel 0 1,443 Mar-31-2020, 02:33 PM
Last Post: arbiel
  Scilab -> Python translation silverfish 0 5,079 Mar-23-2018, 07:35 AM
Last Post: silverfish
  Python2 to Python3 translation - .keys() 20salmon 1 3,516 Nov-03-2017, 10:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020