Python 的几个模块

  • input

  • output

  • 顺序执行(sequential execution)

  • 条件执行(conditional execution)

>>> from datetime import datetime


Python 例子


name = input('Enter file:')
handle = open(name, 'r')
counts = dict()

for line in handle:
      words = line.split()
      for word in words:
         counts[word] = counts.get(word, 0) + 1

bigcount = None
bigword = None
for word, count in list(counts.items()):
      if bigcount is None or count > bigcount:
         bigword = word
         bigcount = count

print(bigword, bigcount)

# Code:

not on PATH

WARNING: The script tomato is installed in '/home/vagrant/.local/bin' which is not on PATH.
   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

export PATH=/home/vagrant/.local/bin:$PATH 放在 .zshrc 的最后一行。