Python:如何打印范围 a-z?

2022-01-24 00:00:00 python list string ascii range

问题描述

1.打印 a-n: a b c d e f g h i j k l m n

1. Print a-n: a b c d e f g h i j k l m n

<强>2.a-n 中的每一秒: a c e g i k m

2. Every second in a-n: a c e g i k m

3.附加到 urls{hello.com/, hej.com/, ..., hallo.com/} 的索引: hello.com/a hej.com/b ... hallo.com/n

3. Append a-n to index of urls{hello.com/, hej.com/, ..., hallo.com/}: hello.com/a hej.com/b ... hallo.com/n


解决方案

>>> import string
>>> string.ascii_lowercase[:14]
'abcdefghijklmn'
>>> string.ascii_lowercase[:14:2]
'acegikm'

要做网址,你可以使用类似这样的东西

To do the urls, you could use something like this

[i + j for i, j in zip(list_of_urls, string.ascii_lowercase[:14])]

相关文章