len tag

6 questions


1 answers
126 views
0
(python) The need for len

fname = input('Enter fline name: ')if len(fname) < 1 : fname = 'mbox-short.txt'fh = open(fname)count = 0for line in fh : if 'From ' in line : mail = line.split() print(mail[1]) count = count + 1...

2 years ago

1 answers
99 views
0
(Python) len traceback, error in .rstrip

name = input ('Enter file name: ')if len(name) > 1 : name = 'mbox-short.txt'filename = open(name)for line in filename : if 'From ' in line : print(line.rstrip) else : continueprint(filename)(1)I'...

2 years ago

2 answers
124 views
0
strlen and string

I wonder why David921 read from the file through the strlen function has a length of 9.When reading the same David921 length through gets, the length is 8 so I wonder why this difference occurs.


1 answers
109 views
0
How do I figure out the length of the array?

How do I figure out how many elements can fit in an array?It's not how many values I've allocatedI'd like to know how many can fit.

2 years ago

1 answers
103 views
0
Is strlen() calculated every time in the for statement?

for (int i = 0; i < strlen(ss); ++i){ // Hello}If you think about it, the ss might change inside the for statementI think strlen(ss) should be calculated every timeBut if you do strlen() every time...

2 years ago

2 answers
95 views
0
In Python, the values come in dictionary form. I want to use the len function to get the largest number, but what should I do?

I'm coding to get the value I want from Python.First of all, I specified a value for c and r and appended it to shot_listAnd we used print(len(set(shot_list))) to see the largest number here There are...

2 years ago

© 2024 OneMinuteCode. All rights reserved.