我有一堆列表,我想从左到右反转它们的字符串内容。
如何转换x
x = ['TARDBP', 'BUB3', 'TOP2A', 'SYNCRIP', 'KPNB1']
到
x = ['KPNB1', 'SYNCRIP', 'TOP2A', 'BUB3', 'TARDBP']
答案 0 :(得分:2)
就像
一样简单// SignalR checks if it's running in a Mono environment and then
// disables features like performance counters
// .NET Core isn't Mono, but doesn't have the performance counters DLL
// Let's make .NET Core a Mono
var signalRAssembly = typeof(Microsoft.AspNet.SignalR.PersistentConnection).Assembly;
// This type is internal
var monoUtility = signalRAssembly.GetType("Microsoft.AspNet.SignalR.Infrastructure.MonoUtility");
var field = monoUtility.GetField(
"_isRunningMono",
BindingFlags.NonPublic | BindingFlags.Static
);
field.SetValue(null, new System.Lazy<bool>(() => true));
.......
答案 1 :(得分:2)
您可以这样做:
mpg %>%
filter(fl=="p" | fl=="r" & cyl!="5") %>%
sample_n(100) %>%
ggplot(aes(cyl, hwy, fill=drv)) +
stat_boxplot(geom = "errorbar", width=0.5, position = position_dodge(1)) +
geom_boxplot(position = position_dodge(1), outlier.shape = NA)+
geom_point(aes(fill = drv, shape = fl, group = drv), color="black",
alpha =0.5, size=3,
position = position_jitterdodge(jitter.width = .1, dodge.width = 1)) +
scale_shape_manual (values = c(21,23) ) +
guides(fill = guide_legend(override.aes = list(shape = NA) ) )
或者这个:
x = x[::-1]
您还可以按如下方式执行就地反向:
x = list(reversed(x))
答案 2 :(得分:0)
def reverse(L):
if L == []:
return []
else:
return reverse(L[1:]) + [L[0]]
print(['TARDBP', 'BUB3', 'TOP2A', 'SYNCRIP', 'KPNB1'])
print(reverse(['TARDBP', 'BUB3', 'TOP2A', 'SYNCRIP', 'KPNB1']))