小编Col*_*ole的帖子

将一个字符串拆分(NOT PARSE)到命令行参数C#

敬礼,

我有一个似乎是一个简单的问题,但非常不是.我想取一个字符串并将其拆分为命令行参数.几周来我一直在谷歌搜索这个问题,找不到任何适合我需要的东西.

例如,行: --foo=bar -foo="bar test" --foo "bar \"test\"" --foo bar

会分成:( 按此顺序)

  • --foo=bar
  • -foo=bar test
  • --foo
  • bar "test"
  • --foo
  • bar

编辑

是的我意识到--foo一次使用更多.这是分裂/标记化.不解析,这是下一步.当我去解析时,我不在乎是否会出错.我现在要做的是将字符串转换为数组状态,然后我可以将其输入Mono.Options

编辑2

阅读这个例子.这就是我想要实现的目标.只是那个.

.net c# command-line-arguments

9
推荐指数
1
解决办法
2180
查看次数

如何在 matplotlib 中设置绘图的外部背景颜色

问候,

我想在 matplotlib 中更改绘图的外部颜色。我可以找到许多关于如何更改内部 bg 颜色但外部 bg 颜色拒绝更改的示例。

图像的白色部分是我所说的“外部”背景。最外面的颜色只是为了对比白色,所以它不会与堆栈溢出背景混合,也不是绘图/图表的一部分。

图表

我试过用set_facecolor()它来改变它,但它不起作用。

# Setting up data
x = list(history['daily'].keys())[-30*months:]
x_av = list(history['average'].keys())[-30*months:]
y = list(history['daily'].values())[-30*months:]
y_av = list(history['average'].values())[-30*months:]

# Setting up figure
fig = pyplot.figure()
fig.set_figheight(6)
fig.set_figwidth(12)

# Formatting figure
fig.patch.set_antialiased(True)

# Setting up axis
ax = fig.add_subplot(111, axisbg='#2e3136')
ax.plot(x, y, '#e1bb34', x_av, y_av, '#b2dbee')

# Formatting axis
ax.get_yaxis().grid(color='#3e4146', linestyle='-')
ax.get_xaxis().grid(color='#3e4146', linestyle='-')

ax.spines['bottom'].set_color('#1e2124')
ax.spines['top'].set_color('#1e2124')
ax.spines['left'].set_color('#1e2124')
ax.spines['right'].set_color('#1e2124')

ax.get_yaxis().set_major_formatter(ticker.FuncFormatter(lambda _y, p: '{:,}'.format(_y)))
ax.get_xaxis().set_major_formatter(ticker.FuncFormatter(lambda _x, p: datetime.fromtimestamp(_x/1000.0).strftime('%b %d')))

[i.set_color('white') for i in pyplot.gca().get_xticklabels()] …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

3
推荐指数
1
解决办法
1351
查看次数

标签 统计

.net ×1

c# ×1

command-line-arguments ×1

matplotlib ×1

python ×1