473,549 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to add serial number in lines of a text file in python

1 New Member
Hi!!!
I have a txt file with many lines. I want to add a serial number and ':' in each line starting from the firtst line. For example:
I have: line1
line2
end i want:
1:line1
2:line2
Jun 15 '17 #1
0 1364

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2668
by: | last post by:
Hi, Do memory sticks have serial numbers like harddrives? If so how can I get this, I want to uniquely identify a memory stick (removable drive) for authentication. Thanks
2
1806
by: vagaisuresh | last post by:
Dear Friends, Dealers details retreived from database and display in a asp file. I want to display the serial number. I don't know, how to display the serial number. anybody help me Thanks Suresh <% Dim db Dim rs
6
4062
by: leegold | last post by:
say I have a text file: zz3 uaa4a ss 7 uu zz 3 zzzz66 ppazz9 aaaaaaaaa00000zz0 I want to sort the text file. I want the key to be the number after the two "zz". Or I guess a string of two zz then a number....So that's 3, 9, 0
5
7117
by: Johnymap | last post by:
Hi everyone I have text file which looks like these: "index.txt" Johan 22 sebaya "home.hml" Mpho 23 leboa "index.frt" Tedesca 24 teba My problem is i want to read the number on the last sentence. At the current moment I can only read the whole of the last sentence. Please help
7
1525
by: kashif73 | last post by:
I have a text file , from which I read a single line & display it in my form. How can I read the line number for that particular line, which is being displayed in my form?? Thanks.
4
1768
by: lightning18 | last post by:
I have a list of incorrect words called # words and another list containing my txt file # text. I want to print the line number of the words located in the text. I get the following error for my code. invalid syntax: print(text, d) I am trying to print the words with its line number located in the text but it is not working its only...
2
3101
by: vkk49 | last post by:
hi i want to generate serial number in text box when i click on button.so please help me
1
1917
by: dhineshk6 | last post by:
Hi all, I have a version.txt file and it looks like Script=01 build date=yy.mm.dd Mainversion=1.00.00.00:01 need a batch script or C# code increment the version if i trigger a build and expected output as Script=02 build date=yy.mm.dd (Current date)
1
1612
by: Bjork | last post by:
Hello.. i would like to ask you. Its long time i did something in java.. and now I am lost. :) I have text file with constant elements in line but variable number of lines... text file looks like asdf 12 54 12 brjk 45 2 14 etc.. I want to make array from this file. Can you help me with my code? This not working.. String part = new...
0
7730
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7491
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5101
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3509
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3491
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.