Created
December 8, 2023 12:59
-
-
Save altilunium/27eadc58f2e25566c3315919c2400ab4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify the file path | |
file_path = 'a1.txt' | |
zatot = 0 | |
# Open the file in read mode | |
with open(file_path, 'r') as file: | |
# Process each line in the file | |
for line in file: | |
# Do something with the line (replace this with your processing logic) | |
processed_line = line.strip() # Removing leading and trailing whitespaces | |
zanum = "" | |
for c in processed_line: | |
if c.isdigit(): | |
zanum = zanum + c | |
break | |
for c in reversed(processed_line): | |
if c.isdigit(): | |
zanum = zanum + c | |
break | |
zanum = int(zanum) | |
zatot = zatot +zanum | |
print(processed_line) # Print the processed line as an example | |
print(zanum) | |
print(zatot) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment