python-2.7 tag

27 questions


1 answers
81 views
0
Python novice grammar questions.

if ch in digits: return { 0: {k1or4: 1 if k1or4 in digits else 4 for k1or4 in digits+letters}, 1: {k1: 1 for k1 in digits}, }[aa][ch]I understand the Dictionary expression, but I don't know how ...

1 years ago

1 answers
96 views
0
This is a question related to entering the Python list.

I wanted to put a time string in the first column of the list, so I organized the code. matrix = [[0 for col in range(11)] for row in range(400)] time = datetime.datetime(1990, 1, 1, 9, 0) temp = time...

1 years ago

2 answers
75 views
0
Python Matrix Random Mix Question.

import randomA = [[0, 1, 2, 3, 4, 5], [1, 0, 3, 4, 5, 6], [2, 3, 0, 5, 6, 7], [3, 4, 5, 0, 7, 8], [4, 5, 6, 7, 0, 9], [5, 6, 7, 8, 9, 0]]new_order = random.shuffle(A)A[:] = [A[i] for i in new_ord...

1 years ago

1 answers
91 views
0
I wonder how to enter a string with a line in Python.

Python wants to receive string input via raw_input().However, the input string contains several lines.For example, the following is the example.string = raw_input(hex code : )Input string 01 | string1...


1 answers
97 views
0
Why is "not(True) in [False, True]" False?

False in [False, True] = TrueWhy?not(True) in [False, True] = FalseIs it?not(True) is False?

1 years ago

1 answers
79 views
0
What's wrong with too many arguments?

if __name__ == __main__: parser = argparse.ArgumentParser() parser.add_argument(fn) parser.add_argument(js_pl) parser.add_argument(-i, --iteb) args = parser.parse_args() if args.iteb: _iif(args.js_pl...

1 years ago

1 answers
106 views
0
Django Primary Key Error Question!

Code (models.py)class UserProfile(models.Model): user = models.OneToOneField(User) schoolid = models.CharField(max_length=5,unique=True,null=False,db_index=True) phone_number = models.CharField(max_le...

1 years ago

1 answers
74 views
0
During django installation with cmd, an error appears and cannot be installed.

I want to install Python and django.Installation continues to fail with an error related to pip version. The same error appears when I try the pip upgrade command as shown below.I have no idea what th...

1 years ago

1 answers
106 views
0
Python 2 Repeating Question

I'm learning based on Python 2! (I don't know why I'm learning it the old way.)The code I made for this problem is as below, but I don't know what's wrongPlease give strength to Python beginners!

1 years ago

1 answers
100 views
0
Python Multiple List Divide Questions

I posted the same question a few days ago and I'll ask you one more time. def random_chunk(li, min_chunk=1, max_chunk=3): it = iter(li) while True: nxt = list(islice(it,randint(min_chunk,max_chunk)))...

1 years ago
« - 2 - »

© 2024 OneMinuteCode. All rights reserved.