d = {'count': 9,
'data': [{'amount': '0.1',
'customer_order_id': '109317257',
'date': 1654517494009,
'direction': 'BUY',
'id': 109317257,
'portfolio_id': 1,
'price': '0.1',
'remaining_amount': '0.1',
'status': 'CANCELLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [],
'trading_pair_id': 1,
'type': 'LIMIT'},
{'amount': '1',
'customer_order_id': '107613290',
'date': 1655130347003,
'direction': 'BUY',
'id': 107613290,
'portfolio_id': 1,
'price': '0.1200',
'remaining_amount': '0',
'status': 'FILLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [{'id': 336335,
'price': '0.12',
'time': 1655130347003,
'value': '1'}],
'trading_pair_id': 48,
'type': 'LIMIT'},
{'amount': '40',
'customer_order_id': '103699645',
'date': 1651665830607,
'direction': 'BUY',
'id': 103699645,
'portfolio_id': 1,
'price': '0.1414',
'remaining_amount': '0',
'status': 'FILLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [{'id': 179691,
'price': '0.141',
'time': 1651665830607,
'value': '40'}],
'trading_pair_id': 48,
'type': 'MARKET'},
{'amount': '5000',
'customer_order_id': '103655679',
'date': 1651585314315,
'direction': 'BUY',
'id': 103655679,
'portfolio_id': 1,
'price': '0.1302',
'remaining_amount': '0',
'status': 'FILLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [{'id': 174070,
'price': '0.1289',
'time': 1651585314315,
'value': '5000'}],
'trading_pair_id': 48,
'type': 'MARKET'},
{'amount': '1',
'customer_order_id': '103655666',
'date': 1651585258788,
'direction': 'BUY',
'id': 103655666,
'portfolio_id': 1,
'price': '0.1302',
'remaining_amount': '0',
'status': 'FILLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [{'id': 174068,
'price': '0.1289',
'time': 1651585258788,
'value': '1'}],
'trading_pair_id': 48,
'type': 'MARKET'},
{'amount': '0.003',
'customer_order_id': '103232017',
'date': 1651007532982,
'direction': 'SELL',
'id': 103232017,
'portfolio_id': 1,
'price': '549780.00',
'remaining_amount': '0.000',
'status': 'FILLED',
'stop_price': None,
'time_in_force': 'GTC',
'trades': [{'id': 137448,
'price': '561000',
'time': 1651007532982,
'value': '0.003'}],
'trading_pair_id': 50,
'type': 'MARKET'}],
'limit': 10,
'offset': 0}
for i in d['data']:
if(i['direction']=='BUY' and i['trading_pair_id'] == 48 and i['status'] == 'FILLED'):
print(i['price'])
尝试此代码
import datetime
n = int(input())
a = list(map(int, input().split()))
start_time = datetime.now()
i = 1
k = 1
actions = 0
while i < n:
if a[i] < a[i - 1]:
actions = -1
break
elif a[i] == a[i - 1]:
i += 1
k += 1
elif a[i] > a[i - 1]:
for j in range(k):
a[j] += 1
j += 1
actions += 1
print(actions)
print(datetime.now() - start_time) # time consumed on run
问题是另一个Component
未在 testbed
中声明。这就是编译器抱怨的内容。
测试中使用的所有组件都需要在测试台中声明(或通过该模块导入)
添加 entercomponent
添加到测试床声明中,您应该没问题:
TestBed.configureTestingModule({
declarations: [HelloWorldComponent, AnotherComponent],
...
您可能必须添加另一个Component的依赖关系您的声明/提供商/进口。
如果有人仍在寻找我上述问题的答案。以下是对我有用的代码。
import openpyxl
import os
from openpyxl import load_workbook
import glob
from pathlib import Path
Excel_file_path="/Excel"
for file in Path(Excel_file_path).glob('*_Updated.xlsx'):
wb=load_workbook(file)
wb_modified = False
for sheet in wb.worksheets:
max_row_in_sheet = sheet.max_row
max_col_in_sheet = sheet.max_column
sheet_modified = False
if max_row_in_sheet > 1:
first_nonempty_row = get_first_nonempty_row() # Function to find nonempty row
sheet_modified = del_rows_before(first_nonempty_row) #Function to delete nonempty roW
file_name = os.path.basename(file)
wb.save("Excel/"+file_name[:-5]+"_Transformed.xlsx")
wb.close()
两个播放器逻辑(如实现)
- 标记
- 在所有字段上单击迭代时第一个活动播放器,直到确定单击字段,
- 如果它是播放器a的回合 play play a turn else player b turn
n 播放器逻辑(根据您的布尔数组的想法)
- 标记布尔值数组中的第一个活动播放器,
- 请在所有字段上单击迭代,直到在所有播放器上识别出单击字段
- ,直到Active Player k ,然后do player k turn 和标记下一个活动播放器 j =(k+1)播放器的模数
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for(int i=0;i<size;i++) {
if(e.getSource()==buttons[i]) {
// iterate over players to find next active player
for (int k = 0; k < 3; k++ ) { // 3 players
if (players[k]) {
// next active player found
if(buttons[i].getText()=="") {
buttons[i].setForeground(new Color(0,0,255));
buttons[i].setText(pIcon[k]);
players[k]=false;
int j = (k + 1) % 3; // index for next active player
players[j] = true; // mark next active player
txt.setText(pIcon[j] + " turn");
checkCondition();
break; // leave inner loop
}
}
}
}
}
}
}
});
使用SetState更新列表,还可以从构建方法中删除列表声明
class _MyHomePageState extends State<MyHomePage> {
List<int> list = [1, 2, 3, 4, 5];
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
bottom: const TabBar(
tabs: [
Tab(icon: Icon(Icons.recycling_outlined)),
Tab(icon: Icon(Icons.directions_transit)),
Tab(icon: Icon(Icons.directions_bike)),
],
),
),
body: TabBarView(
children: [
ListView.builder(
padding: const EdgeInsets.all(4.0),
itemCount: list.length,
itemBuilder: (context, index) {
var item = list[index];
return Dismissible(
key: Key(item.toString()),
onDismissed: (direction) {
setState(() {
list.removeAt(index);
});
},
child: ListTile(
title: Text(item.toString()),
),
);
},
),
const Icon(Icons.directions_transit),
const Icon(Icons.directions_bike),
],
),
),
);
}
}
在for循环中,您每次运行 mood_list = list()
每次运行时都会重新定义列表。相反,您需要做这样的事情:
mood = input('What anime do you want:')
mood_list = []
#print random anime
for item in anime:
if item[1] == mood:
k = item[0]
print(mood + ' anime = ' + item [0])
mood_list.append(k)
而不是将您的凭据(直接或通过环境变量)编码 suppiect.txt
文件,而是应该配置凭证助手用于git。
将裸露的URL留在您的 unignts.txt
文件:
git+https://github.com/johnf1004/my_package.git
配置适当的凭据助手,例如 GH CLI 。在最近的版本中,您可以运行 gh auth setup-git
来创建必要的配置。
运行 GH auth Login
以对GitHub进行身份验证:
$ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: ABCD-1234
Press Enter to open github.com in your browser...
Opening in existing browser session.
✓ Authentication complete.
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Logged in as larsks
现在 git
将获得 https://github.com
urls的凭据。 /代码>不需要您的任何互动。
您必须通过选择“承载者”来添加您拍摄的最后一步,否则会给您带来错误。我在最后一个步骤上很难做,然后执行以下链接,这应该有所帮助。
您在寻找这个吗?
success = [
item for item in errors
if item["name"] not in names and item["type"] == "direct_queried"
]
我也遇到了这个问题。
截至编写此答案的那一刻,此处的SDK =&lt; v3.12.3由于与平台一起使用平台视图,如其版本中所述,log 在这里 。
解决方案是使用FVM并使用Flutter版本2.10.5运行该应用程序。
const router = require("express").Router(),
const User=require("../database/models/User.model.js");
const cryptoJS = require("crypto-js");
//REGISTER
router.post("/register", async (req, res) => {
const { username, email, password } = req.body;
const checkUser = await User.findOne({ email: email })
if (checkUser) {
return res.status(400).json({
message: "This email is alredy existing in our database"
});
} else {
const user = new User({
username: username,
email: email,
password: cryptoJS.AES.encrypt(
password,
process.env.CRYPTO_KEY
)
});
await user.save()
.then(data=>res.json(data))
.catch(err => res.status(500).json({ error: err.message }));
}
});
module.exports = router;
答案在角度深处。
您正在使用 keyvaluepipe
。 source 。
我们感兴趣的管道的一部分是:
const differChanges: KeyValueChanges<K, V>|null = this.differ.diff(input as any);
const compareFnChanged = compareFn !== this.compareFn;
if (differChanges || compareFnChanged) {
this.keyValues.sort(compareFn);
this.compareFn = compareFn;
}
如果差异会发现输入对象的差异,则将运行Sort函数。
您可以控制数字 and Code>,并在初始化视图后始终如一地返回 null
。为什么?我们需要查看:
// Add the record or a given key to the list of changes only when the value has actually changed
private _maybeAddToChanges(record: KeyValueChangeRecord_<K, V>, newValue: any): void {
if (!Object.is(newValue, record.currentValue)) {
record.previousValue = record.currentValue;
record.currentValue = newValue;
this._addToChanges(record);
}
}
差异是使用 object.is(newValue,record.currentvalue)
来确定值是否已更改。在这种情况下要分散的对象的值是对象本身, object.is()
不会评估深度平等。
因此,您至少有两个选择:
- 编写自己的钥匙值管,以您想要的方式工作。
- 使用不同的数据结构保存您的电影信息
我已经创建了一个工作的stackblitz 使用自定义的Brute-Force诉讼策略 keyValue
管道。
试试看:
for(int j = 0; j < height_of_gamefield; j++)
{
printf("%s%*s\n","|", width_of_gamefield,"|");
}
%*s允许您为字符串填充指定变量号。
确定可以。听起来您想使用 sumif 结合了减法。
对于您的情况,公式可能是:
lt; y/n&gt;,&lt;条件的
=&lt;启动值&gt; -sumif( &
n
在B列中的A1到A10Y
启动值是100
Sure you can. Sounds like you want to use SUMIF combined with a subtraction.
For your case, the formula will likely be:
=<start value>-SUMIF(<range of Y/N>, <condition>, <range of values>)
e.g. for a sheet with:
Y
orN
in column A, from A1 to A10Y
You would use
=100-SUMIF(A1:A10, "=Y", B1:B10)
从数字减去if statment