'Can anyone help me with npm --prefix?
I'm stuck with npm --prefix. I'm trying to prefix my frontend folder so I can run both the backend and frontend at the same time.
I keep getting an error with the wrong pathway: \backend\frontend/package.json.
Can anyone help me with that?
{
"name": "backend",
"version": "1.0.0",
"description": "User Authentication APP - MERN stack",
"main": "server.js",
"scripts": {
"start": "node backend/server.js",
"server": "nodemon backend/server.js",
"client": "npm start --prefix frontend ",
"dev": "concurrently \"npm run server\" \"npm run client\""
}
}
Solution 1:[1]
You can do that using Numpy and list comprehension, which is faster than a for loop:
import numpy as np
a=np.array([[0,1,2,3,4],[5,6,7,8,9],[10,11,12,13,14],[15,16,17,18,19]])
coor=[(0,1),(3,4),(1,2)]
myList=[a[c] for c in coor]
print(myList)
Solution 2:[2]
Use np.transpose to transform coor variable:
m = np.array(a)
myList = m[tuple(np.transpose(coor))].tolist()
Output:
>>> myList
[1, 19, 7]
>>> np.transpose(coor)
array([[0, 3, 1],
[1, 4, 2]])
Solution 3:[3]
Check
[np.array(a)[x] for x in coor]
Out[201]: [1, 19, 7]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | OnY |
| Solution 2 | Corralien |
| Solution 3 | BENY |
