fPath = raw_input('File Path:')
counter = 0;
flag = 0;
with open(fPath) as f:
content = f.readlines()
for line in content:
if flag == 0 and line.find("WECS number") or \
line.find("WECS number") or \
line.find("WECS name") or \
line.find("Manufacturer") or \
line.find("Type") or \
line.find("Nominal effect") or \
line.find("Hub height") or \
line.find("x (local)") or \
line.find("y (local)") or \
line.find("x (global)") or \
line.find("y (global)"):
if not line.find("y (global)"):
print ("Alert Last Line!");
else:
print("Alert Line!");
Run Code Online (Sandbox Code Playgroud)
由于某种原因,代码似乎是打印"警报线!" 如果一行只是"\n".我创建"if和or"结构的意图是忽略所有不包含line.find …
{
"hintsacross":
[ { "number":"1" , "hinttext":"Hurt", "hintsquare":"A1" },
{ "number":"5" , "hinttext":"Make a selection", "hintsquare":"A6" },
{ "number":"8" , "hinttext":"Frank", "hintsquare":"A10" }
] ,
"hintsdown":
[ { "number":"1" , "hinttext":"First Greek letter", "hintsquare":"A1" },
{ "number":"2" , "hinttext":"Used footnotes", "hintsquare":"A2" },
{ "number":"3" , "hinttext":"Listened to", "hintsquare":"A3" }
]
}
Run Code Online (Sandbox Code Playgroud)
由于某些原因,PHP的json_decode没有解码这个JSON.
提前致谢...
PS我在第25行运行时遇到错误:
$ temp = json_decode($ obj-> hints,true);
解析错误:语法错误,第25行的C:\ Program Files(x86)\ Zend\Apache2\htdocs\crosswords\query.blockouts.php中的意外'hintsacross'(T_STRING)
我通过JSONlint验证了我的JSON,并且出现了解析错误.
{
"wordsacross": [
{"ACHE": [
{ "letter":"A" , "square":"A1" },
{ "letter":"C" , "square":"A2" },
{ "letter":"H" , "square":"A3" },
{ "letter":"E" , "square":"A4" }
]},
{"OPT": [
{ "letter":"O" , "square":"A6" },
{ "letter":"P" , "square":"A7" },
{ "letter":"T" , "square":"A8" }
]}
],
"wordsdown": [
{"ALPHA": [
{ "letter":"A" , "square":"A1" },
{ "letter":"L" , "square":"B1" },
{ "letter":"P" , "square":"C1" },
{ "letter":"H" , "square":"D1" },
{ "letter":"A" , "square":"E1" }
]},
{"BRO": [
{ "letter":"B" , …Run Code Online (Sandbox Code Playgroud) class WakeUP
{
[DllImport("kernel32.dll")]
public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes,
bool bManualReset,
string lpTimerName);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWaitableTimer(SafeWaitHandle hTimer,
[In] ref long pDueTime,
int lPeriod,
IntPtr pfnCompletionRoutine,
IntPtr lpArgToCompletionRoutine,
bool fResume);
public event EventHandler Woken;
private BackgroundWorker bgWorker = new BackgroundWorker();
public WakeUP()
{
bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork);
bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted);
}
public void SetWakeUpTime(DateTime time, String tName)
{
// Create a 7-tuple.
var wutargs = new Tuple<string, string>(time.ToFileTime().ToString(), tName.ToString());
bgWorker.RunWorkerAsync(wutargs);
} …Run Code Online (Sandbox Code Playgroud) PS C:\ImageMagick> convert -background transparent -fill hsb(0%,0%,0%) -font Arial -pointsize 18 -size 18x26 -gravity center label:p "output2.png"
At line:1 char:51
+ convert -background transparent -fill hsb(0%,0%,0%) -font Arial -pointsize 18 -s ...
+ ~
You must provide a value expression following the '%' operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
Run Code Online (Sandbox Code Playgroud)
上面的命令在cmd窗口中没有任何问题,在PowerShell中引发了一个错误,我在上面粘贴了它.我看了很多文章,但还没有找到一个好的解决方案.
我或许他们正在谈论hsb我在引文中包围的电话:
PS C:\ImageMagick> convert -background transparent -fill "hsb(0%,0%,0%)" -font Arial -pointsize 18 -size 18x26 -gravity center label:p "output2.png"
Invalid Parameter - transparent …Run Code Online (Sandbox Code Playgroud) json ×2
arrays ×1
c# ×1
decode ×1
imagemagick ×1
io ×1
javascript ×1
php ×1
powershell ×1
python ×1
tuples ×1