Metodo expandtabs python3 ()
descrizione
metodo per simbolo scheda stringa ( '\ t') nello spazio, scheda simbolo ( '\ t') expandtabs () è il numero predefinito di spazi 8.
grammatica
expandtabs () metodo di sintassi:
str.expandtabs(tabsize=8)
parametri
- tabsize - specificare la scheda simbolo stringa di conversione ( '\ t') in caratteri di spazio.
Valore di ritorno
Il nuovo metodo di generazione stringa restituisce un simbolo scheda stringa ( '\ t') nello spazio dopo.
Esempi
L'esempio seguente mostra un esempio di expandtabs () metodo:
#!/usr/bin/python3 str = "this is\tstring example....wow!!!" print ("原始字符串: " + str) print ("替换 \\t 符号: " + str.expandtabs()) print ("使用16个空格替换 \\t 符号: " + str.expandtabs(16))
Esempi dei risultati di output di cui sopra sono i seguenti:
原始字符串: this is string example....wow!!! 替换 \t 符号: this is string example....wow!!! 使用16个空格替换 \t 符号: this is string example....wow!!!