用字母替换数字

时间:2019-04-29 03:09:04

标签: python replace numbers alphabetical

在循环python for i in range(0, randPile): randRock = random.randint(1, 8) print('Pile {}: {}'.format(i + 1, 'O' * randRock)) rockList.append(randRock)

中将数字替换为字母的正确方法是什么?

我有输出:

第1堆:OOOOOO
桩2:OOOOO
桩3:OOOOOOO

我想要

A:00000 B:0000 C:00000

像这样删除具有A的桩1,具有B的桩2和具有C的桩3

1 个答案:

答案 0 :(得分:0)

内置col2将在提供的代码点返回Unicode字符。 NaNOut[60]: col1 col2 2000-01-01 00:00:00 0 0.0 2000-01-01 00:03:00 3 3.0 2000-01-01 00:06:00 6 NaN <--- if there at least one col has data,the whole row will be used in resample 2000-01-01 00:09:00 8 NaN chrchr(65),依此类推。因此'A'应该给您正确的字母。

相关问题