当我运行我的命令时,我得到如下所示的输出。如何删除每次u'
?
[u'Massimo Eraldo Abate', u'Valentina Abate', u'Carlo Abbate', u'Francesca Abbate', u'Ines Abbate', u'Isabella Abbate', u'Maria Abbattista', u'Claudia Abbruzzese', u'Amina Abdeddaim', u'Jaber Sami Abdel', u'Lul Abdi Ali', u'Paola Abele', u'Massimo Abelli', u'Damiano Abeni', u'Gabriella Abolafio', u'Elisabetta Above', u'Jubin Abutalebi', u'Barbara Acaia', u'Domenico Acanfora', u'Massimo Accardo', u'Rosanna Accardo', u'Alice Acciaioli', u'Nicola Acciarri', u'Elisa Nicoletta Accornero', u'Davide Acerbi', u'Francesco Acerbi', u'Maria Teresa Achilarre', u'Gaetano Achille']
答案 0 :(得分:1)
您可以使用list comprehension
对列表中的各个元素进行编码。
[u.encode("utf-8") for u in url_list]
答案 1 :(得分:0)
完整编码过程的新完整脚本:
byte[]
答案 2 :(得分:0)
When you want to break down a nested list like that and just convert to string so you can output the list... you just need to strip and then join... which is a much more pythonic way... But if thats not the case ... when you yield as item... it wont show up... but what I was mentioning...
library(broom)
library(dplyr)
library(tidyr)
W <- rep(letters[seq( from = 1, to = 2)], 25)
X <- rnorm(n=50, mean = 10, sd = 5)
Y <- rnorm(n=50, mean = 15, sd = 6)
Z <- rnorm(n=50, mean = 20, sd = 5)
test_data <- data.frame(W, X, Y, Z)
test_data %>%
gather(variable, value, X:Z) %>%
group_by(variable) %>%
do(., tidy(t.test(value ~ W, data = .)))
This will make your "strings/list" into and actual string of which you can then us to write... if thats the purpose...?