Python usage Categorize files by province, and look forward to teaching them

Updated on technology 2024-05-22
12 answers
  1. Anonymous users2024-02-11

    1300018 Guangdong.

    1300019 Guangdong.

    1300100 Beijing.

    1300101 Beijing.

    1300126 Beijing.

    1300127 Beijing.

    1300128 Beijing.

    1300129 Beijing.

    1300130 Tianjin.

    1300131 Tianjin.

    1300132 Tianjin.

    1300133 Tianjin.

    #!/usr/bin/env python# _*coding: utf-8 _*

    q={}with open('') as f:

    d =for i in d:

    q[for i in d:

    q[for k,v in :

    file_name=str(k)+str(len(v))for i in v:

    with open(file_name,'a') as f:

    s'%str(i))

    The result is as follows:

    more Guangdong 2

    more Beijing 6

    more Tianjin 4

  2. Anonymous users2024-02-10

    How do you tell which province it is? Also, what are the rules for sorting files?

  3. Anonymous users2024-02-09

    As I understand it, when called, the system automatically creates a shell and then executes yours'mkdir file;cd file;touch ;'ï¼›When the execution is completed and returned, the shell is over and you are back in your current shell environment. Therefore, it is necessary to call'file') to modify the environment variables before your subsequent commands can run properly.

  4. Anonymous users2024-02-08

    S is not reset to an empty string after execution, so the value of S is always additive, not the value after the CHR sequence.

    for i in range(1,8):

    for line in f1:

    s=''Add s= at the end''That's it.

  5. Anonymous users2024-02-07

    f1=open('')

    s=''ls=

    for line in f1:

    if 'chr' in line:

    continue

    s+=line

    print ls

    You can try, there is not so much judgment!

  6. Anonymous users2024-02-06

    There is no problem with the saved py file, double-click it and it will disappear in a flash because your python script has been executed.

    With the condition of making sure that your python installation path is added to the path of the environment variable, open cmd, find the location of your py file, type python, and you will see the execution result.

    In IDLE, you can press F5 to execute the script you wrote, and if it is not saved, you will be prompted to save.

  7. Anonymous users2024-02-05

    If you are running a Windows operating system, the method of running a python file can be:

    Start --> run --> enter cmd enter to bring up the command line --> the command line to enter python (your file).py (you can drag the py file directly into the black box with the mouse) -- enter.

    If you want to use the IDE you can use the Eclipse + Python plugin, so that you can also add breakpoint debugging, which is very convenient.

  8. Anonymous users2024-02-04

    SCP commands are difficult to implement programmatically because they require a password.

    Put a python program on each server and read the host's hosts file non-stop.

  9. Anonymous users2024-02-03

    Well, I won't think about it so much, if this kind of problem arises, just add the line ** and remove the {} ......

    fns = ''

    if fns[0] == '':

    fns = fns[1:-1]

    print fns

  10. Anonymous users2024-02-02

    Use a try, and it should fix the problem. Don't forget to like it.

  11. Anonymous users2024-02-01

    You can take a look at what topics other people or previous years' C language assignments use, and just pick one or two.

  12. Anonymous users2024-01-31

    Judging from the error message, there is a problem with the MB compilation, and it should not be a problem with Python.

Related questions
8 answers2024-05-22

Removed the long type, there is now only one integer, int, but it behaves like a version of long >>>More

3 answers2024-05-22

The size of the installation package is different, the function is different, and the nature is different. >>>More

4 answers2024-05-22

The first. Find a crawler to outsource the job.

The most common way for web crawlers to make money is to do small and medium-sized crawler projects through outsourcing, providing data scraping, data structuring, data cleaning and other services to Party A. Most of the new programmers will try this direction first, and make money directly by technical means, which is also the best way for technicians, but because there are too many competitors, it may not be very expensive, and the price of cabbage. >>>More

2 answers2024-05-22

The English articles are: the; a;an sometimes some counts. >>>More

10 answers2024-05-22

python install

Add environment variables (the path should be filled in the scripts folder in your own python directory). >>>More