Metodo expandtabs Python ()
descrizione
metodo per simbolo scheda stringa ( '\ t') nello spazio, scheda simbolo ( '\ t') expandtabs Python () è 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/python str = "this is\tstring example....wow!!!"; print "Original string: " + str; print "Defualt exapanded tab: " + str.expandtabs(); print "Double exapanded tab: " + str.expandtabs(16);
Esempi dei risultati di output di cui sopra sono i seguenti:
Original string: this is string example....wow!!! Defualt exapanded tab: this is string example....wow!!! Double exapanded tab: this is string example....wow!!!